#cmake file for project opencl
#author:guyadong
#created:2016/01/09
cmake_minimum_required( VERSION 2.6 )
##############定义facesdk位置##############

## 对给定的library_name,在lib_dir中查找import library，
## 定义为{library_name}(大写)_LIBRARY_IMPORT全局变量
function(defineImportLibraryVariable library_name lib_dir)
	string(TOUPPER ${library_name} var_prefix)
	##查找${library_name}的动态导入库(import library)
	unset(${var_prefix}_LIBRARY_IMPORT CACHE)
	find_library( ${var_prefix}_LIBRARY_IMPORT
		NAMES ${library_name}
		PATHS "${lib_dir}/lib"
		DOC "${var_prefix} import library"
		NO_DEFAULT_PATH
	)
	message(STATUS "${var_prefix}_LIBRARY_IMPORT=${${var_prefix}_LIBRARY_IMPORT}" )
endfunction()

if ( WIN32)
	unset(FACESDK_DIR CACHE)
	unset(FACESDK_INCLUDE CACHE)
	##############定义facesdk include位置##############
	set(FACESDK_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/include" CACHE INTERNAL "facesdk include folder" )

	set ( facesdk_flolder "${CMAKE_CURRENT_LIST_DIR}")
	if( NOT IS_DIRECTORY "${facesdk_flolder}" )
		message(FATAL_ERROR "not found fitted facesdk directory:${facesdk_flolder}") 
	endif()
	set( FACESDK_DIR "${facesdk_flolder}" CACHE INTERNAL "facesdk folder")
	message(STATUS "FACESDK_DIR=${FACESDK_DIR}" )	
	
	##定义facesdk动态导入库
	defineImportLibraryVariable(FD_SHSTD ${FACESDK_DIR})
	defineImportLibraryVariable(FR_IV_STD ${FACESDK_DIR})
	defineImportLibraryVariable(FR_SHSTD ${FACESDK_DIR})
	defineImportLibraryVariable(FS_FD_Inf ${FACESDK_DIR})
	defineImportLibraryVariable(FS_FR_Inf ${FACESDK_DIR})
endif()



